#ifndef QDICETHREAD_H
#define QDICETHREAD_H
#include <QThread>
#include <QMutex>

class QDiceThread: public QThread
{
    Q_OBJECT
private:
    QMutex mutex;//互斥量
    int seq = 0;
    int diceValue;
    bool pause = true;
    bool stop = false;
protected:
    void run() Q_DECL_OVERRIDE;
public :
    QDiceThread();
    void diceBegin();
    void dicePause();
    void threadStop();
    bool readValue(int *seq, int *diceValue);//用于外部线程读取掷骰子的次数和点数，传递参数采用指针，方便一次读取两个数据
signals:
    void newValue(int seq, int diceValue);
};

#endif // QDICETHREAD_H
